home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1986 December / Ahoy_Magazine_86-12_1986_Double_L.d64 / Basic Recursion (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  225b  |  11 lines

  1. 0 rem << cd36-2 >>
  2. 5 print"[147]         basic recursion"
  3. 10 s$="tteessstt"
  4. 20 n=1 : p(n)=1 : gosub 80
  5. 30 end
  6. 80 p=p(n)
  7. 90 if mid$(s$,p,1)<>mid$(s$,p+1,1) then print mid$(s$,p,1);
  8. 100 if p<len(s$) then n=n+1: p(n)=p+1: gosub 80
  9. 105 print p(n);
  10. 110 n=n-1 : return
  11.